import { FC } from "react";
import { Navigate, Route, Routes } from "react-router-dom";
import Index from '../src/layout/Index'
import { useAppSelector } from "./store/hooks";
import {Index as Login} from './views/login/Index'



type AppProps = {}
const App: FC = (props: AppProps) => {

  const loginState = useAppSelector((state:any) => state.user.loginState)

  return (
    <Routes>
      <Route path="/login" element = { loginState ? <Navigate to="/" /> : <Login /> } />
      <Route path="/*" element = { loginState ? <Index /> : <Navigate to="/login" /> } />
    </Routes>
  )
}
export default App
